home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Python 1.3 / Python 1.3 PPC / Tools / bgen / ae / Finder_Required_Suite.py < prev    next >
Encoding:
Python Source  |  1995-10-11  |  3.0 KB  |  103 lines  |  [TEXT/PYTH]

  1. """Suite Required Suite: Terms that every application should support
  2. Level 1, version 1
  3.  
  4. Generated from Moes:System folder:Extensions:Finder Scripting Extension
  5. AETE/AEUT resource version 0/144, language 0, script 0
  6. """
  7.  
  8. import addpack
  9. addpack.addpack('Tools')
  10. addpack.addpack('bgen')
  11. addpack.addpack('ae')
  12.  
  13. import aetools
  14. import MacOS
  15.  
  16. _code = 'reqd'
  17.  
  18. class Required_Suite:
  19.  
  20.     def open(self, _object, _attributes={}, **_arguments):
  21.         """open: Open the specified object(s)
  22.         Required argument: list of objects to open
  23.         Keyword argument _attributes: AppleEvent attribute dictionary
  24.         """
  25.         _code = 'aevt'
  26.         _subcode = 'odoc'
  27.  
  28.         _arguments['----'] = _object
  29.  
  30.         if _arguments: raise TypeError, 'No optional args expected'
  31.  
  32.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  33.                 _arguments, _attributes)
  34.         if _arguments.has_key('errn'):
  35.             raise MacOS.Error, aetools.decodeerror(_arguments)
  36.         # XXXX Optionally decode result
  37.         if _arguments.has_key('----'):
  38.             return _arguments['----']
  39.  
  40.     _argmap__print = {
  41.         'items' : 'fsel',
  42.     }
  43.  
  44.     def _print(self, _object, _attributes={}, **_arguments):
  45.         """print: Print the specified object(s)
  46.         Required argument: list of objects to print
  47.         Keyword argument items: DO NOT USE: provided for backwards compatibility with old event suite.  Will be removed in future Finders
  48.         Keyword argument _attributes: AppleEvent attribute dictionary
  49.         """
  50.         _code = 'aevt'
  51.         _subcode = 'pdoc'
  52.  
  53.         _arguments['----'] = _object
  54.  
  55.         aetools.keysubst(_arguments, self._argmap__print)
  56.  
  57.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  58.                 _arguments, _attributes)
  59.         if _arguments.has_key('errn'):
  60.             raise MacOS.Error, aetools.decodeerror(_arguments)
  61.         # XXXX Optionally decode result
  62.         if _arguments.has_key('----'):
  63.             return _arguments['----']
  64.  
  65.     def quit(self, _no_object=None, _attributes={}, **_arguments):
  66.         """quit: Quit the Finder (direct parameter ignored)
  67.         Keyword argument _attributes: AppleEvent attribute dictionary
  68.         """
  69.         _code = 'aevt'
  70.         _subcode = 'quit'
  71.  
  72.         if _no_object != None: raise TypeError, 'No direct arg expected'
  73.  
  74.         if _arguments: raise TypeError, 'No optional args expected'
  75.  
  76.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  77.                 _arguments, _attributes)
  78.         if _arguments.has_key('errn'):
  79.             raise MacOS.Error, aetools.decodeerror(_arguments)
  80.         # XXXX Optionally decode result
  81.         if _arguments.has_key('----'):
  82.             return _arguments['----']
  83.  
  84.     def run(self, _no_object=None, _attributes={}, **_arguments):
  85.         """run: Sent to an application when it is double-clicked
  86.         Keyword argument _attributes: AppleEvent attribute dictionary
  87.         """
  88.         _code = 'aevt'
  89.         _subcode = 'oapp'
  90.  
  91.         if _no_object != None: raise TypeError, 'No direct arg expected'
  92.  
  93.         if _arguments: raise TypeError, 'No optional args expected'
  94.  
  95.         _reply, _arguments, _attributes = self.send(_code, _subcode,
  96.                 _arguments, _attributes)
  97.         if _arguments.has_key('errn'):
  98.             raise MacOS.Error, aetools.decodeerror(_arguments)
  99.         # XXXX Optionally decode result
  100.         if _arguments.has_key('----'):
  101.             return _arguments['----']
  102.  
  103.